package com.sfc.spiderweb.rest;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sfc.spiderweb.entity.param.AmazonTransferParam;
import com.sfc.spiderweb.entity.po.AmazonTransfer;
import com.sfc.spiderweb.entity.vo.AmazonTransferVo;
import com.sfc.spiderweb.entity.vo.Result;
import com.sfc.spiderweb.service.AmazonTransferService;
import com.sfc.spiderweb.util.BeanUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

@Api(tags = "amazon日转款接口 ->Earl")
@RestController
@RequestMapping(value = "/amazonTransfer")
@Slf4j
public class AmazonTransferController {

    @Autowired
    private AmazonTransferService service;

    @ApiOperation(value = "amazon日转款信息查询 ->Earl", notes = "amazon日转款信息查询")
    @PostMapping("/getPage")
    public Result<Page<AmazonTransferVo>> amazonTransfer(@Valid @RequestBody AmazonTransferParam param) {
        Page<AmazonTransfer> page = service.getPage(param);
        return Result.success(BeanUtil.copyPageInfo(page, AmazonTransferVo.class));
    }
}
